Debugging in PHP has never been easier

The DebugBar integrates easily in any projects and can display profiling data from any part of your application. It comes built-in with data collectors for standard PHP features and popular projects.

Install the debug bar using Composer:

{
  "require": {
    "maximebf/debugbar": "1.*"
  }
}
$ php composer.phar install

The DebugBar has two parts: the main DebugBar object with data collectors and the renderer. Data collectors are objects collecting a specific set of data. To makes things easy, the StandardDebugBar has all the built-in collectors activated.

<?php
use DebugBar\StandardDebugBar;

$debugbar = new StandardDebugBar();
$debugbarRenderer = $debugbar->getJavascriptRenderer();

$debugbar["messages"]->addMessage("hello world!");
?>
<html>
<head>
    <?php echo $debugbarRenderer->renderHead() ?>
</head>
<body>
    ...
    <?php echo $debugbarRenderer->render() ?>
</body>
</html>

Try it below!

Messages4Request10msRequest DurationTimeline1.25MBMemory UsageExceptions1Database6
  • helloinfo
  • worldwarning
  • Array ( [toto] => Array ( [0] => titi [1] => tata ) ) info
  • oupserror
$_GET
Array ( )
$_POST
Array ( )
$_COOKIE
Array ( [PHPSESSID] => qj57lsa5hrtamv0d28sfgq3sv3 )
$_SERVER
Array ( [HTTP_HOST] => 192.168.56.101 [HTTP_CONNECTION] => keep-alive [HTTP_ACCEPT] => t...
  • sleep 500 (1ms)
  • sleep 400 (1ms)
  • render (1ms)
  • Something failed!/php-debugbar/demo/failed.php#6Exception
    include 'bootstrap.php';

    try {
        throw new Exception('Something failed!');
    } catch (Exception $e) {
        $debugbar['exceptions']->addException($e);
    }
6 statements were executed, 1 of which failed1ms1.5MB
  • create table users (name varchar)0ms1.25MB0
  • insert into users (name) values (<foo>)0ms1.5MB1000000006ef9f64b00000000a141d954
  • insert into users (name) values (<bar>)0ms1.5MB1000000006ef9f64b00000000a141d954
  • select * from users0ms1.5MB0
  • select * from users where name=<foo>0ms1.5MB0000000006ef9f65400000000a141d954
  • delete from unknown_table0ms1.5MB[0] no such table: unknown_table